package com.talent.service.iot.mqtt.service;

import com.talent.service.iot.mqtt.model.entity.TlSubClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * @ClassName：IMqttSubService
 * @Author: hszhou
 * @Date: 2025/1/8 9:17
 * @Description: 必须描述类做什么事情, 实现什么功能
 */
public interface IMqttSubscriptionService {


    /**
     * 保存客户订阅的主题
     * @param clientSub
     * @return
     */
    Mono<TlSubClient> subscribe(TlSubClient clientSub);


    /**
     * 解除订阅
     * @param clientId
     * @param topic
     * @return
     */
    Mono<TlSubClient> unsubscribe(String clientId, String  topic);

    /**
     * 获取订阅了 topic 的客户id
     * @param topic
     * @return
     */
    Flux<TlSubClient> find(String topic);

    /**
     * 移除客户订阅
     * @param clientId
     */
    Mono<Void> clear(String clientId);



}
